<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>修改密码</title>
		<link rel="stylesheet" href="../../utils/layui/css/layui.css">
	</head>
	<body>
		<div class="layuimini-container page_container" style="padding-top: 10px;">
		    <div class="layuimini-main">
				<form class="layui-form" action="">
		            <div class="layui-form layuimini-form">
		                <div class="layui-form-item">
		                    <label class="layui-form-label required">旧的密码</label>
		                    <div class="layui-input-block">
		                        <input type="password" autocomplete="off"  name="old_password" lay-verify="required" lay-reqtext="旧的密码不能为空" placeholder="请输入旧的密码"  value="" class="layui-input">
		                        <tip>填写自己账号的旧的密码。</tip>
		                    </div>
		                </div>
		    
		                <div class="layui-form-item">
		                    <label class="layui-form-label required">新的密码</label>
		                    <div class="layui-input-block">
		                        <input type="password" autocomplete="off"  name="new_password" lay-verify="required" minlength="6"  lay-reqtext="新的密码不能为空" placeholder="请输入新的密码"  value="" class="layui-input">
		                    </div>
		                </div>
		                <div class="layui-form-item">
		                    <label class="layui-form-label required">确认密码</label>
		                    <div class="layui-input-block">
		                        <input type="password" autocomplete="off"  name="again_password" minlength="6" lay-verify="required" lay-reqtext="确认密码不能为空" placeholder="请输入确认密码"  value="" class="layui-input">
		                    </div>
		                </div>
		    
		                <div class="layui-form-item">
		                    <div class="layui-input-block">
		                        <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
		                    </div>
		                </div>
		            </div>
		        </form>
		    </div>
		    
		</div>
		<script src="/admin/utils/layui/layui.js" charset="utf-8"></script>
		<script src="/admin/utils/layui/config.js" charset="utf-8"></script>
		<script type="text/javascript">
			layui.use(['form', 'helper'], function(){
			  var form = layui.form;
			  
			  //监听提交
			  form.on('submit(saveBtn)', function(data){
				  var formData = data.field;
				if(formData['new_password'].length < 6){
					noticeMsg("error", "密码不能少于6位");
					return false;
				}  
				if(formData['new_password'] != formData['again_password']){
					noticeMsg("error","两次密码不一致");
					return false;
				}
				ajax_request(baseApi.userPasswordUrl, 'POST', data.field, function(res){
					noticeMsg("success","密码修改成功,请重新登录");
					parent.window.location.reload();
				});
			    return false;
			  });
			});
		</script>
	</body>
</html>
